package com.drug.controller;

import com.drug.domain.DrugInformation;
import com.drug.domain.Result;
import com.drug.domain.SdiDiInf;
import com.drug.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/CommodityController")
public class CommodityController{

    @Autowired
    private CommodityService commodityService;


    /**
     * 供货添加
     * @param sdiId
     * @return
     */
    @RequestMapping("/addSdi")
    private Result addSdi(String[] sdiId ,Integer surId ){
        surId=1;
        return commodityService.addSdi(sdiId,surId);

    }


    /**
     * 已审核供货查询
     * @param map
     * @param pageNum
     * @return
     */
    @RequestMapping(value = "/findAllDCSdi")
    private Result findAllDCSdi(@RequestParam Map<String,Object> map, @RequestParam(required=true,defaultValue="1")Integer pageNum){
        return  commodityService.findAllDCSdi(map,pageNum);
    }

    /**
     * 取消供货
     */
    @RequestMapping(value = "/updateSdi")
    private Result updateSdi(String[] sdiId ){
      return  commodityService.updaueSdi(sdiId);
    }

    /**
     * 修改药品的信息
     */

    @RequestMapping(value = "/updateDif")
    private Result updateDif( DrugInformation drugInformation){
        return  commodityService.updateDif(drugInformation);
    }
}
